package org.shuma.user.mng.config;

import org.shuma.user.mng.Interceptor.AuthInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author : liuming
 * @date : 2024/6/18 上午7:55
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private AuthInterceptor authInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authInterceptor)
                .addPathPatterns("/user", "/user/**", "/token", "/logout")
                .excludePathPatterns("/user/password");
        WebMvcConfigurer.super.addInterceptors(registry);
    }
}
